﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FuckCore.DAO;
using FuckData.Model;

namespace FuckData.DAO
{
    public class PlaceDAO : BaseDAO<GoEasyEntities, tbl_Place>
    {
        /// <summary>
        /// Create by DucND
        /// Datecreate 17/01/2014
        /// Get list of Place by category
        /// </summary>
        /// <returns></returns>
        public List<tbl_Place> GetListPlaceByCat(long CategoryID)
        {
            var Result = from place in ObjectContext.tbl_Place
                         where place.Status == 1 && place.CategoryID == CategoryID
                         select place;
            return Result.Count() > 0 ? Result.ToList() : null;
        }

        public tbl_Place GetPlaceByID(long PlaceByID)
        {
            var Result = from place in ObjectContext.tbl_Place
                         where place.ID == PlaceByID
                         select place;
            return Result.Count() > 0 ? Result.FirstOrDefault() : null;
        }

    }
}
